/*
 * Copyright 2018 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.rz.paas.test.inChannel.bottomMenuFragment

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import com.rz.paas.test.R
import com.rz.paas.test.inChannel.adapter.VideoData
import com.rz.paas.test.inChannel.adapter.VideoListAdapter
import com.rz.paas.test.inChannel.bottomMenuFragment.adapter.UserInfoAdapter
import com.rz.paas.test.inChannel.bottomMenuFragment.adapter.UserInfoData
import kotlinx.android.synthetic.main.fragment_communication.*
import kotlinx.android.synthetic.main.fragment_user_information.*
import kotlin.random.Random

class UserInformationFragment : Fragment() {

    private val userInfoAdapter by lazy {
        UserInfoAdapter(requireContext())
    }

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {

        return inflater.inflate(R.layout.fragment_user_information,container,false)
    }


    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        user_info_rv.layoutManager = LinearLayoutManager(context)
        user_info_rv.itemAnimator = null
        user_info_rv.adapter = userInfoAdapter

        val listData = mutableListOf<UserInfoData>()
        initData(listData)
        userInfoAdapter.data = listData
    }

    private fun initData(listData: MutableList<UserInfoData>) {
        for (index in 0..30) {
            var userInfoData = UserInfoData()
            listData.add(userInfoData)
        }
    }
}
